function h = ana_timestamps(s1,s2)
%GETTIMESTAMPS	analyse time stamps from different time series of the same patient
%	[tstamps] = gettimestamps(s1,s2) 
%
%	Inputs:     s1, s2 -    timeseries s1 and s2 (Nx1 or Nxm with time as
%                           first column)
%
%	Outputs:    h           figure handle
%		
%	
%	See also explore_data.m

%	References: N/A
%	
%	

%	Copyright 2013 MAF Pimentel
%	This program is free software: you can redistribute it and/or modify
%	it under the terms of the GNU General Public License as published by
%	the Free Software Foundation, either version 3 of the License, or
%	(at your option) any later version.
%	
%	This program is distributed in the hope that it will be useful,
%	but WITHOUT ANY WARRANTY; without even the implied warranty of
%	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%	GNU General Public License for more details.
%	
%	You should have received a copy of the GNU General Public License
%	along with this program.  If not, see <http://www.gnu.org/licenses/>.


%	$Author: MAF Pimentel$
%	$Revision: 1.0.0.0$
%	$Date: 30-May-2013 10:12:30$
%	Contact: marco.and.pimentel@gmail.com
%	Originally written on: PCWIN64

N1 = size(s1,1); N2 = size(s2,1);

fprintf('\nMin distance between two time instances of s1: %.1f', min(diff(s1(:,1))));
fprintf('\nMin distance between two time instances of s2: %.1f', min(diff(s2(:,1))));

fprintf('\n\nMax distance between two time instances of s1: %.1f', max(diff(s1(:,1))));
fprintf('\nMax distance between two time instances of s2: %.1f\n\n', max(diff(s2(:,1))));

h = figure;
subplot(121);
hist(diff(s1(:,1)),min(diff(s1(:,1))):min(diff(s1(:,1))):max(diff(s1(:,1))));
xlabel('diff(t) (mins)'); ylabel('counts'); title(sprintf('S1, Total Obs.: %d',N1));
subplot(122);
hist(diff(s2(:,1)),min(diff(s2(:,1))):min(diff(s2(:,1))):max(diff(s2(:,1))));
xlabel('diff(t) (mins)'); ylabel('counts'); title(sprintf('S2, Total Obs.: %d',N2));

end